import http from "@/http";
const flfApl = {

}
//汽车品牌
flfApl.addCar = (type) => {
  let Response
  http({
    url: "/automobileBrand/insert",
    method: "POST",
    data: {
      "id": 0,
      "name": type
    }
  })
    .then((res) => {
      Response = res
      console.log('查询Car', res)
    })
    .catch((err) => {
      console.log('订单来源数据获取失败', err)
    })
  return Response
}
//4s店
flfApl.addCarShop = (data) => {
  let Response
  http({
    url: "/s4Shop/insert",
    method: "POST",
    data: data
  })
    .then((res) => {
      Response = res
      console.log('获取4sxdcdcd', res)

    })
    .catch((err) => {
      console.log('订单来源数据获取失败', err)
    })
  return Response
}
//4s店查询
flfApl.inquiryCar = (type, page, size) => {
  return new Promise((resolve, reject) => {
    http({
      url: "/s4Shop/selectLikeNameByPage",
      method: "POST",
      params: {
        name: type,
        page,
        size,
      }
    })
      .then((res) => {
        resolve(res.data.data)


        //  console.log('查询4s',res)
        //  console.log('查询4S23',xuanran)
      })
      .catch((err) => {
        reject(err)
        console.log('订单来源数据获取失败', err)
      })
  })
}
//4s编辑
flfApl.xiugaiCarShop = (data) => {
  let Response
  http({
    url: "/s4Shop/update",
    method: "POST",
    data: data
  })
    .then((res) => {
      Response = res
      console.log('获取修改订单', res)
    })
    .catch((err) => {
      console.log('订单来源数据获取失败', err)
    })
  return Response
}

//修理厂
flfApl.addRepairShop = (data) => {
  let Response
  http({
    url: "/repairDepot/insert",
    method: "POST",
    data: data
  })
    .then((res) => {
      Response = res
      console.log('获取修理厂', res)
      this.getInit(this.page, this.size);
    })
    .catch((err) => {
      console.log('订单来源数据获取失败', err)
    })
  return Response
}
//修理厂修改
flfApl.xiugaiRepairShop = (data) => {
  let Response
  http({
    url: "/repairDepot/update",
    method: "POST",
    data: data
  })
    .then((res) => {
      Response = res
      console.log('获取修改订单', res)
    })
    .catch((err) => {
      console.log('订单来源数据获取失败', err)
    })
  return Response
}
//修理厂查询
flfApl.inquiryRepairCar = (type, page, size) => {
  return new Promise((resolve, reject) => {
    http({
      url: "/repairDepot/selectLikeNameByPage",
      method: "POST",
      params: {
        name: type,
        page,
        size,
      }
    })
      .then((res) => {
        resolve(res.data.data)

      })
      .catch((err) => {
        reject(err)
        console.log('订单来源数据获取失败', err)
      })
  })
}
//快修店
flfApl.addCreepyShop = (data) => {
  let Response
  http({
    url: "/expressRepairShop/insert",
    method: "POST",
    data: data
  })
    .then((res) => {
      Response = res
      console.log('获取快修店', res)
      this.getInit(this.page, this.size);
    })
    .catch((err) => {
      console.log('订单来源数据获取失败', err)
    })
  return Response
}
//快修店修改
flfApl.xiugaiCreepyShop = (data) => {
  let Response
  http({
    url: "/expressRepairShop/update",
    method: "POST",
    data: data
  })
    .then((res) => {
      Response = res
      console.log('获取修改订单', res)
    })
    .catch((err) => {
      console.log('订单来源数据获取失败', err)
    })
  return Response
}
//快修店查询
flfApl.inquirycreepyCar = (type, page, size) => {
  return new Promise((resolve, reject) => {
    http({
      url: "/expressRepairShop/selectLikeNameByPage",
      method: "POST",
      params: {
        name: type,
        page,
        size,
      }
    })
      .then((res) => {
        resolve(res.data.data)

      })
      .catch((err) => {
        reject(err)
        console.log('订单来源数据获取失败', err)
      })
  })
}
export default flfApl